package com.sosmcc.controller;

import com.sosmcc.common.OrderService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @User: c.c
 * @Date: 2022/6/17
 * @Time: 10:19
 * @Description:
 */

@RestController
@RequestMapping("/dubbonacos")
public class SayController {

//  注意这里OrderService，要求是必须是接口，否则会报错，这里的OrderService是dubbo-NAcos-common里提供的，跟provide一点关系都没有，要说关系只是使用了provide里的方法
  @DubboReference
  private OrderService sayHelloService;

  @GetMapping("/sayhello")
  public ResponseEntity<String> SayHello(@RequestParam("name") String name){
    return ResponseEntity.ok(sayHelloService.sayhello("hello",99));
  }
}
